home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / mac / misc / biology / treedraw.sit / Tree Draw Deck / background_5410.txt < prev    next >
Encoding:
Text File  |  1990-06-26  |  8.4 KB  |  397 lines

  1. -- background: 5410 from stack: in
  2. -- bmap block id: 3915
  3. -- flags: 4000
  4. -- background id: 0
  5. -- name: Plot.back
  6. ----- HyperTalk script -----
  7. --
  8. -- uses XCMDs  drawgram, hp2pict, getPutfilename
  9. --
  10. --     drawgram, drawtree XCMD calls
  11. --
  12. --  drawgram tree, [parameters,] [output fld]
  13. --    the result contains the HP plot
  14. --
  15. --     hp2pict XCMD calls
  16. --
  17. --  hp2pict "open",name, [plotrect] ;  returns window pointer
  18. --    open blank window
  19. --  hp2pict "drawc",window pointer, HPcontainer
  20. --    draw HP container to window
  21. --  hp2pict "file",window pointer,filename, [file creator]
  22. --    save window pict as file
  23. --  hp2pict "clip",window pointer
  24. --    put window pict into clipbd
  25. --  hp2pict "print",window pointer
  26. --    print window pict
  27. --  hp2pict "close",window pointer
  28. --    close window
  29. --
  30. --    XFCN GetPutFilename
  31. --
  32. --  get getPutFilename("TEXT")  -- std get for TEXT files
  33. --  get getPutFilename()   -- std get for any file
  34. --  get getPutFilename("Put","Prompt","Default name")
  35. --      std put for file, with optional prompt and default name
  36. --
  37.  
  38. on closeBackground
  39.   closeplot
  40. end closeBackground
  41.  
  42. on newPlot
  43.   global plotWindow, plotfiled
  44.   set cursor to watch
  45.   put the rect of bg button "plotsize" into plotsize
  46.   hp2pict "OPEN", field "title", plotsize
  47.   put the result into plotWindow
  48.   put false into plotfiled
  49.   show bg button "Close plot"
  50.   show bg button "Clip plot"
  51.   show bg button "File plot"
  52.   show bg button "Print plot"
  53.   show bg button "Edit plot"
  54. end newPlot
  55.  
  56. on closeplot
  57.   global plotWindow
  58.   if (plotWindow is not empty) and (plotWindow is not 0) then
  59.     hp2pict "CLOSE",plotWindow
  60.     put empty into plotWindow
  61.   end if
  62.   hide bg button "Close plot"
  63.   hide bg button "Clip plot"
  64.   hide bg button "File plot"
  65.   hide bg button "Print plot"
  66.   hide bg button "Edit plot"
  67. end closeplot
  68.  
  69. on CallDrawGram
  70.   -- message sent from run card
  71.   global plotWindow, treefile, parmfile, hp
  72.   newplot
  73.   drawgram treefile, parmfile, "output"
  74.   put the result into hp
  75.   if hp is empty then
  76.     closeplot
  77.     answer "Plot failed." with "Continue"
  78.   else
  79.     hp2pict "DRAWC", plotWindow, hp
  80.   end if
  81. end CallDrawGram
  82.  
  83. on CallDrawTree
  84.   -- message sent from run card
  85.   global plotWindow, treefile, parmfile, hp
  86.   newplot
  87.   drawtree treefile, parmfile, "output"
  88.   put the result into hp
  89.   if hp is empty then
  90.     closeplot
  91.     answer "Plot failed." with "Continue"
  92.   else
  93.     hp2pict "DRAWC", plotWindow, hp
  94.   end if
  95. end CallDrawTree
  96.  
  97. on CallPlotGram
  98.   -- message sent from run card
  99.   global plotWindow, treefile, parmfile, hp
  100.   newplot
  101.   plotgram treefile, parmfile, "output"
  102.   put the result into hp
  103.   if hp is empty then
  104.     closeplot
  105.     answer "Plot failed." with "Continue"
  106.   else
  107.     hp2pict "DRAWC", plotWindow, hp
  108.   end if
  109. end CallPlotGram
  110.  
  111. on CallPlotTree
  112.   -- message sent from run card
  113.   global plotWindow, treefile, parmfile, hp
  114.   newplot
  115.   ploTree treefile, parmfile, "output"
  116.   put the result into hp
  117.   if hp is empty then
  118.     closeplot
  119.     answer "Plot failed." with "Continue"
  120.   else
  121.     hp2pict "DRAWC", plotWindow, hp
  122.   end if
  123. end CallPlotTree
  124.  
  125. on clipPlot
  126.   global plotWindow
  127.   hp2pict "CLIP",plotWindow
  128.   put rect of bg button "plotsize" into plotsize
  129.   DoMenu "Paste Picture"
  130.   -- auto selects paint tool
  131.   put item 1 to 2 of plotsize into pt
  132.   drag from 0,0 to pt
  133.   choose browse tool
  134.   show bg button "Save card"
  135. end clipPlot
  136.  
  137. on printPlot
  138.   global plotWindow
  139.   hp2pict "PRINT", plotWindow
  140. end printPlot
  141.  
  142. on filePlot
  143.   -- some programs that can edit PICTures:
  144.   -- "MDPL" is MacDraw II (default)
  145.   -- "SPNT" is SuperPaint
  146.   -- "MDRW" is original MacDraw
  147.   -- ? is Canvas
  148.   global plotWindow, filename, plotfiled
  149.   put GetPutFilename("Put", "Save plot as:", field "title") into filename
  150.   if filename Γëá empty then
  151.     hp2pict "FILE", plotWindow, filename, "MDPL"
  152.     put true into plotfiled
  153.   end if
  154. end filePlot
  155.  
  156. on editPlot
  157.   global filename, plotfiled
  158.   if plotfiled Γëá true then fileplot
  159.   if plotfiled is true then
  160.     open filename with "MacDraw II"
  161.     --open filename with "Canvas 2.0"
  162.     --open filename with "SuperPaint 2.0"
  163.   end if
  164. end editPlot
  165.  
  166. -- end plot.back
  167.  
  168.  
  169.  
  170. -- part 6 (field)
  171. -- low flags: 00
  172. -- high flags: 0000
  173. -- rect: left=18 top=8 right=37 bottom=348
  174. -- title width / last selected line: 0
  175. -- icon id / first selected line: 0 / 0
  176. -- text alignment: 0
  177. -- font id: 3
  178. -- text size: 18
  179. -- style flags: 256
  180. -- line height: 24
  181. -- part name: title
  182.  
  183.  
  184. -- part 20 (button)
  185. -- low flags: 00
  186. -- high flags: 0000
  187. -- rect: left=0 top=48 right=342 bottom=437
  188. -- title width / last selected line: 0
  189. -- icon id / first selected line: 0 / 0
  190. -- text alignment: 1
  191. -- font id: 0
  192. -- text size: 12
  193. -- style flags: 0
  194. -- line height: 16
  195. -- part name: plotsize
  196.  
  197.  
  198. -- part 21 (field)
  199. -- low flags: 01
  200. -- high flags: 0007
  201. -- rect: left=10 top=60 right=274 bottom=430
  202. -- title width / last selected line: 0
  203. -- icon id / first selected line: 0 / 0
  204. -- text alignment: 0
  205. -- font id: 3
  206. -- text size: 9
  207. -- style flags: 0
  208. -- line height: 12
  209. -- part name: output
  210.  
  211.  
  212. -- part 24 (button)
  213. -- low flags: 80
  214. -- high flags: A004
  215. -- rect: left=441 top=85 right=110 bottom=512
  216. -- title width / last selected line: 0
  217. -- icon id / first selected line: 0 / 0
  218. -- text alignment: 1
  219. -- font id: 0
  220. -- text size: 12
  221. -- style flags: 0
  222. -- line height: 16
  223. -- part name: Close Plot
  224. ----- HyperTalk script -----
  225. on mouseUp
  226.   closeplot
  227. end mouseUp
  228.  
  229.  
  230.  
  231. -- part 25 (button)
  232. -- low flags: 80
  233. -- high flags: A004
  234. -- rect: left=451 top=112 right=135 bottom=512
  235. -- title width / last selected line: 0
  236. -- icon id / first selected line: 0 / 0
  237. -- text alignment: 1
  238. -- font id: 0
  239. -- text size: 12
  240. -- style flags: 0
  241. -- line height: 16
  242. -- part name: Clip Plot
  243. ----- HyperTalk script -----
  244. on mouseUp
  245.   clipPlot
  246. end mouseUp
  247.  
  248.  
  249.  
  250. -- part 26 (button)
  251. -- low flags: 80
  252. -- high flags: A004
  253. -- rect: left=453 top=139 right=189 bottom=508
  254. -- title width / last selected line: 0
  255. -- icon id / first selected line: 1007 / 1007
  256. -- text alignment: 1
  257. -- font id: 0
  258. -- text size: 12
  259. -- style flags: 0
  260. -- line height: 16
  261. -- part name: print plot
  262. ----- HyperTalk script -----
  263. on mouseUp
  264.   printPlot
  265. end mouseUp
  266.  
  267.  
  268.  
  269. -- part 27 (button)
  270. -- low flags: 80
  271. -- high flags: A004
  272. -- rect: left=454 top=190 right=237 bottom=507
  273. -- title width / last selected line: 0
  274. -- icon id / first selected line: 5059 / 5059
  275. -- text alignment: 1
  276. -- font id: 0
  277. -- text size: 12
  278. -- style flags: 0
  279. -- line height: 16
  280. -- part name: file plot
  281. ----- HyperTalk script -----
  282. on mouseUp
  283.   filePlot
  284. end mouseUp
  285.  
  286.  
  287.  
  288. -- part 28 (button)
  289. -- low flags: 00
  290. -- high flags: A004
  291. -- rect: left=442 top=241 right=265 bottom=512
  292. -- title width / last selected line: 0
  293. -- icon id / first selected line: 0 / 0
  294. -- text alignment: 1
  295. -- font id: 0
  296. -- text size: 12
  297. -- style flags: 0
  298. -- line height: 16
  299. -- part name: Save card
  300. ----- HyperTalk script -----
  301. on mouseUp
  302.   push card
  303.   domenu "Copy card"
  304.   domenu "Paste card"
  305.   set name of this card to "Saved.plot"
  306.   set cantdelete of this card to false
  307.   pop card
  308.   hide me
  309. end mouseUp
  310.  
  311.  
  312.  
  313. -- part 29 (button)
  314. -- low flags: 00
  315. -- high flags: 2000
  316. -- rect: left=436 top=9 right=35 bottom=467
  317. -- title width / last selected line: 0
  318. -- icon id / first selected line: 9301 / 9301
  319. -- text alignment: 1
  320. -- font id: 0
  321. -- text size: 12
  322. -- style flags: 0
  323. -- line height: 16
  324. -- part name: Prev
  325. ----- HyperTalk script -----
  326. on mouseUp
  327.   visual effect wipe right
  328.   go to previous card
  329. end mouseUp
  330.  
  331.  
  332.  
  333.  
  334. -- part 30 (button)
  335. -- low flags: 00
  336. -- high flags: 2000
  337. -- rect: left=465 top=9 right=35 bottom=493
  338. -- title width / last selected line: 0
  339. -- icon id / first selected line: 27009 / 27009
  340. -- text alignment: 1
  341. -- font id: 0
  342. -- text size: 12
  343. -- style flags: 0
  344. -- line height: 16
  345. -- part name: Next
  346. ----- HyperTalk script -----
  347. on mouseUp
  348.   visual effect wipe left
  349.   go to next card
  350. end mouseUp
  351.  
  352.  
  353.  
  354.  
  355. -- part 31 (button)
  356. -- low flags: 80
  357. -- high flags: A004
  358. -- rect: left=442 top=274 right=297 bottom=512
  359. -- title width / last selected line: 0
  360. -- icon id / first selected line: 0 / 0
  361. -- text alignment: 1
  362. -- font id: 0
  363. -- text size: 12
  364. -- style flags: 0
  365. -- line height: 16
  366. -- part name: Edit Plot
  367. ----- HyperTalk script -----
  368. on mouseUp
  369.   editplot
  370. end mouseUp
  371.  
  372.  
  373.  
  374. -- part 32 (button)
  375. -- low flags: 00
  376. -- high flags: A003
  377. -- rect: left=406 top=325 right=342 bottom=512
  378. -- title width / last selected line: 0
  379. -- icon id / first selected line: 0 / 0
  380. -- text alignment: 1
  381. -- font id: 0
  382. -- text size: 12
  383. -- style flags: 0
  384. -- line height: 16
  385. -- part name: Hide menubar
  386. ----- HyperTalk script -----
  387. on mouseUp
  388.   if name of me contains "Hide" then
  389.     hide menubar
  390.     set name of me to "Show menubar"
  391.   else
  392.     show menubar
  393.     set name of me to "Hide menubar"
  394.   end if
  395. end mouseUp
  396.  
  397.